package com.example.nongye.adapter;

import androidx.databinding.DataBindingUtil;

import com.example.nongye.R;
import com.example.nongye.databinding.ItemMainBannerBinding;
import com.zhpan.bannerview.BaseBannerAdapter;
import com.zhpan.bannerview.BaseViewHolder;


public class HomeBannerAdapter extends BaseBannerAdapter<Integer> {

    @Override
    protected void bindData(BaseViewHolder<Integer> holder, Integer data, int position,
                            int pageSize) {
        ItemMainBannerBinding dataBinding = DataBindingUtil.bind(holder.itemView);
        if (dataBinding != null) {
            dataBinding.itemBanner.setImageResource(data);
        }
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_main_banner;
    }
}
